"""
自定义异常
"""

class AgeError(Exception):
    pass


while True:
    try:
        age = int(input("输入年龄(18-20):"))
        if not 18 <= age <= 20:
            raise AgeError("年龄不在范围")
    except ValueError as e:
        print(e)
    except AgeError as e:
        print(e)
